package com.cn.gmall.product;

import com.cn.gmall.common.constant.RedisConst;
import org.mybatis.spring.annotation.MapperScan;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan({"com.cn.gmall"})
@EnableDiscoveryClient()

//public class ServiceProductApplication implements CommandLineRunner {
public class ServiceProductApplication  {
//     implements CommandLineRunner 实现这个接口 为了 在应用初始化后 执行run方法
    @Autowired
    private RedissonClient redissonClient;
    public static void main(String[] args) {
        SpringApplication.run(ServiceProductApplication.class, args);
    }

    /**
     * 初始化布隆过滤器
     * @param args
     * @throws Exception
     */
  /*  @Override
    public void run(String... args) throws Exception {
//获取布隆过滤器
        RBloomFilter<Object> bloomFilter = redissonClient.getBloomFilter(RedisConst.SKU_BLOOM_FILTER);

//        设置预计存储量 和误差率  误差越小 成本代价越大
        bloomFilter.tryInit(10000L,0.1);


    }*/
}

